import { request } from "./request"

//获取商品分类
export async function getHttpCateList(queryInfo) {
  return await request({
    method: "get",
    url: "categories",
    params: queryInfo
  })
}

//获取一级，二级商品分类
export async function getHttpParentCateList(type) {
  return await request({
    method: "get",
    url: "categories",
    params: {
      type: type
    }
  })
}

//添加分类
export async function postHttpAddCate(addCateForm) {
  return await request({
    method: "post",
    url: "categories",
    data: addCateForm
  })
}

//修改分类信息
export async function putHttpEditCateById(id,name) {
  return await request({
    method: "put",
    url: 'categories/' + id,
    data: {
      cat_name: name
    }
  })
}

//删除单个权限
export async function deleteHttpDeleteCateById(cateid) {
  return await request({
    method: "delete",
    url: 'categories/' + cateid
  })
}